home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_13_05
/
allison
/
tdate3.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-12
|
508b
|
22 lines
LISTING 9 - Illustrates the Date class
// tdate3.cpp
#include <stdio.h>
#include "date3.h"
#define DATELEN 19
main()
{
Date d1(10,1,1951), d2(3,7,1995);
char buf[DATELEN+1];
int cmp;
printf("d1 == %s\n",d1.format(buf));
printf("d2 == %s\n",d2.format(buf));
cmp = d1.compare(d2);
printf("d1 %s d2\n",(cmp < 0) ? "precedes"
: (cmp > 0) ? "follows"
: "equals");
return 0;
}